package grg.learn.compose.ui.foundations

import androidx.compose.foundation.Canvas
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.height
import androidx.compose.foundation.layout.wrapContentHeight
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.geometry.Offset
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.graphics.drawscope.drawIntoCanvas
import androidx.compose.ui.unit.Dp
import androidx.compose.ui.unit.dp

/**
 * create by iso88591 at 2021/8/21 😘
 * 线
 * @param lineColor 线的颜色
 */
@Composable
fun HLine(
    lineColor: Color,
    lineHeight: Float,
    modifier: Modifier = Modifier
) {

    Canvas(
        modifier = modifier
            .fillMaxWidth()
            .height(lineHeight.dp),
        onDraw = {
            drawIntoCanvas {
                drawLine(
                    lineColor,
                    Offset(0f, 0f),
                    center * 2f,
                    lineHeight
                )
            }

        })
}